<html xmlns:th="http://www.thymeleaf.org">
<head>
	<LINK href="../../style/main_table.css" type=text/css rel=stylesheet th:href="@{/assets/style/main_table.css}">
     <script src="../../js/vue.min.js" th:src="@{/assets/js/vue.min.js}"></script>
	 <script src="../../js/axios.js" th:src="@{/assets/js/axios.js}"></script>
	 <script src="../../js/jquery.js" th:src="@{/assets/js/jquery.js}"></script>
</head>
<title>房屋输入</title>
<body topmargin=0 >

<div id="app1">
    <br><br><br><br><br><br><br><br><br>
    <table border="0"  class="TABLE2" width="40%" height="96" align=center>
	<tr>
        <td nowrap height="3" width="76"><strong>房屋名称</strong></td>
	<td  nowrap height="3" width="197">
	<input type=text size=30 name="name" v-model="name"></td>
	
	</tr>
    <tr>
        <td nowrap height="3" width="76"><strong>面积</strong></td>
	<td  nowrap height="3" width="197">
	<input type=text size=30 name="area" v-model="area"></td>
	
	</tr>
     <tr>
        <td nowrap height="3" width="76"><strong>房屋id</strong></td>
	<td  nowrap height="3" width="197">
	<input type=text size=30 name="hid" v-model="hid"></td>
	
	</tr>
	<tr>
        <td nowrap height="3" width="76"><strong>房屋类型</strong></td>
	<td  nowrap height="3" width="197">
	<input type=text size=30 name="room_type" v-model="room_type"></td>
	
	</tr>
	<tr>
		<td  nowrap height="7" width="100%" colspan="4" align=center>
		<input type="button" value="提交表单"   @click="submitfun()">
	    <input type="button" value="返回主页面" onclick="window.location='/test/system/unit'"/> </td>
	
		</tr>
</table>
</div>
</body>

</html>


<!-- <script type="text/javascript">
$(function(){
	//返回主页面
	$("#goback").click(function(){
		window.location.href="/test/system/unit";
	});

});
</script> -->


<script>
        var app1=new Vue({
            el:'#app1',
            data:{
                name:'',
                area:'',
                room_type:'',
                hid:'',
            },
            
			//qibiename: 多个参数形式：name='+this.name+'&sex='+this.sex+'&age='+this.age 名字和控制器中对象vo的属性名称一致，则自动赋值给对象
            methods: {  
		         submitfun:function () {
					// axios.post('http://localhost:8044/qibieController/add?qibiename='+this.qibiename)
					// 	.then(function (response) {
					//	   console.log(response.data);
					// 		window.location.href="qibie.html";
					// 	}).catch(function (error) {
                    //     console.log(error.message);
					// 	})
					
					axios({
					    method: 'POST',
					    url: '/test/HouseControl/addHouse',
					    params: { //多个字段数据：依次写在下面
					        'name': this.name,
					        'area':this.area,
					        'room_type':this.room_type,
					        'hid':this.room_id,
					       		},
					    headers: {
					      'Content-Type': 'application/x-www-form-urlencoded'
					    }
					} ).then(function (response) {
						    
							window.location.href="/test/system/house";
						}).catch(function (error) {
						  
						})
				},
	
              }
        });
    </script>